import myaxios from '../MyAxios';
//引入路径前缀
import BASEURL from '../BaseUrl';
const { BaseURL } = BASEURL;

const carSeatApi = {
  /**
   * 查询车位
   * @param {Object} params {qid:A}
   */
  querySeat(params) {
    let url = BaseURL + `/v1/query_lots/${params.qid}`;
    return myaxios.get(url);
  },

  /**
   * 通过名称查询车位
   * @param {Object} params {qid:A}
   */
  querySeatById(param) {
    let url = BaseURL + `/v1/query_lot/${param.qid}`;
    return myaxios.get(url);
  },

  /**
   * 修改车位信息
   * @param {Object} params {isEmpty, isEnable, predetermined, arrive_time, inFo, id}
   * @returns Promise
   */
  updateSeat(params) {
    let url = BaseURL + `/v1/updateSeat`;
    return myaxios.post(url, params);
  },

  /**
   * 添加车位
   * @param {Object} params {isEmpty, isEnable, predetermined, arrive_time, inFo, id}
   * @returns Promise
   */
  addSeat(params) {
    let url = BaseURL + `/v1/addSeat`;
    return myaxios.post(url, params);
  },
};

export default carSeatApi;
